-
Notifications
You must be signed in to change notification settings - Fork 154
Changes to SUNDIALS API and core C/C++ needed for Python interfaces #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/python-interfaces
Are you sure you want to change the base?
Conversation
…r constant expression folding
@gardner48 When this is merged into the feature/python-interfaces branch, I don't want the commits squashed so that I don't get a bunch of merge conflicts between this part1 branch and part2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it through docs and include
- For
sunrealtype1d
and similar typedefs, do we want to use them in docs or code only? - Changelog needs updating
* Programmer(s): Cody J. Balos @ LLNL | ||
* ----------------------------------------------------------------------------- | ||
* SUNDIALS Copyright Start | ||
* Copyright (c) 2002-2024, Lawrence Livermore National Security |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Copyright (c) 2002-2024, Lawrence Livermore National Security | |
* Copyright (c) 2002-2025, Lawrence Livermore National Security |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that this wasn't caught automatically by the copyright script.
{ | ||
void operator()(ARKodeButcherTable t) | ||
{ | ||
if (t) { ARKodeButcherTable_Free(t); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (t) { ARKodeButcherTable_Free(t); } | |
ARKodeButcherTable_Free(t); |
sunrealtype t, N_Vector f); | ||
SUNDIALS_EXPORT int MRIStepInnerStepper_GetForcingData( | ||
MRIStepInnerStepper stepper, sunrealtype* tshift, sunrealtype* tscale, | ||
N_Vector** forcing, int* nforcing); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N_Vector** forcing, int* nforcing); | |
N_Vector1d* forcing, int* nforcing); |
* Programmer(s): Cody J. Balos @ LLNL | ||
* ----------------------------------------------------------------------------- | ||
* SUNDIALS Copyright Start | ||
* Copyright (c) 2002-2024, Lawrence Livermore National Security |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Copyright (c) 2002-2024, Lawrence Livermore National Security | |
* Copyright (c) 2002-2025, Lawrence Livermore National Security |
{ | ||
void operator()(MRIStepCoupling t) | ||
{ | ||
if (t) { MRIStepCoupling_Free(t); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (t) { MRIStepCoupling_Free(t); } | |
MRIStepCoupling_Free(t); |
|
||
/* clang-format off */ | ||
enum | ||
enum SUNErrCode_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need some swig #ifdef
that was used in a few other places?
*/ | ||
|
||
enum | ||
enum SUN_GRAMSCHMIDT_ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question about swig ifdef
namespace sundials { | ||
namespace experimental { | ||
|
||
class SUNLoggerView : public sundials::ConvertibleTo<SUNLogger> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question about inheriting from ClassView
. Would that require a major release?
} | ||
|
||
private: | ||
std::unique_ptr<SUNLogger> logger_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about using deleter template argument
typedef _SUNDIALS_STRUCT_ _generic_N_Vector* N_Vector; | ||
|
||
/* Define array of N_Vectors */ | ||
typedef N_Vector* N_Vector_S; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we replace usages of N_Vector_S
with N_Vector1d
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I had a few questions, but I think these are more due to my lack of understanding than this needing corrections.
.. c:function:: SUNErrCode SUNDIALSFileClose(FILE** fp) | ||
Deprecated alias to :c:func:`SUNFileOpen` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated alias to :c:func:`SUNFileOpen` | |
Deprecated alias to :c:func:`SUNFileClose` |
|
||
.. cpp:function:: N_Vector Convert() override | ||
.. cpp:function:: N_Vector get() override | ||
|
||
Explicit conversion to a :c:type:`N_Vector`. | ||
|
||
.. cpp:function:: N_Vector Convert() const override | ||
.. cpp:function:: N_Vector get() const override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these constitute a breaking change? What was the need for changing the member function name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this would be a breaking change. If the name change is necessary, we'll need to also provide Convert
until the next major release.
Deprecated alias to :c:func:`SUNFileOpen`. | ||
.. c:function:: SUNErrCode SUNFileOpen(const char* filename, const char* mode, FILE** fp) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you comment on the need to change SUNDIALSFileOpen
and SUNDIALSFileClose
to SUNFileOpen
and SUNFileClose
for this PR?
SUNContext Convert() override | ||
SUNContext get() override | ||
{ | ||
return *sunctx_.get(); | ||
} | ||
SUNContext Convert() const override | ||
SUNContext get() const override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, is this a breaking change? Why did the member function name need to be changed?
.. cpp:function:: SUNLinearSolver Convert() override | ||
.. cpp:function:: SUNLinearSolver get() override | ||
|
||
Explicit conversion to a :c:type:`SUNLinearSolver`. | ||
|
||
.. cpp:function:: SUNLinearSolver Convert() const override | ||
.. cpp:function:: SUNLinearSolver get() const override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change? Why the name change?
* Programmer(s): Cody J. Balos @ LLNL | ||
* ----------------------------------------------------------------------------- | ||
* SUNDIALS Copyright Start | ||
* Copyright (c) 2002-2024, Lawrence Livermore National Security |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that this wasn't caught automatically by the copyright script.
typedef int (*MRIStepPreInnerFn)(sunrealtype t, N_Vector* f, int nvecs, | ||
typedef int (*MRIStepPreInnerFn)(sunrealtype t, N_Vector1d f, int nvecs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc/shared/sundials/Types.rst
introduced sunrealtypeNd
and sunindextypeNd
, but it never mentioned N_Vector1d
-- should that be added?
SUNDIALS_EXPORT int CVodeSetSensParams(void* cvode_mem, sunrealtype1d p, | ||
sunrealtype1d pbar, int1d plist); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc/shared/sundials/Types.rst
introduced sunindextype1d
but not int1d
-- should this be added to the documentation?
N_Vector Convert() override { return object_.get(); } | ||
N_Vector get() override { return object_.get(); } | ||
|
||
N_Vector Convert() const override { return object_.get(); } | ||
N_Vector get() const override { return object_.get(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change? Why the name change?
T Convert() override { return *object_.get(); } | ||
T get() override { return object_; } | ||
|
||
T Convert() const override { return *object_.get(); } | ||
T get() const override { return object_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing that this is the cause for the member function changes elsewhere in our C++ headers. I don't fully follow the need for this, but I'm ready to take your word on it.
This is the changes that are needed to enable the Python interfaces without the bindings themselves included to make the review process easier.